You are here: Statements and Functions > Break
Syntax samples
BREAK
Exits the innermost WHILE...DO, DO...WHILE, or DO...UNTIL loop. The next statement to be executed will be the one immediately following the END statement associated with the innermost loop. If a BREAK is encountered outside any loop, then ProModel exits the entire logic.
Any logic.
Example
Normally, a WHILE...DO loop repeats a statement block until a certain condition becomes false. This example shows the use of a BREAK statement to exit the loop based on a condition not included in the WHILE...DO loop. As long as the variable V1 is less than three and the variable V3 is less than or equal to five, both the three-minute wait and the five-minute wait will be executed for a total of eight minutes. However, if V3 becomes greater than five, the total wait will be six minutes: three minutes in the main part of the loop and another three minutes inside the IF...THEN statement block. The five minute wait will not be executed because the BREAK statement exits the loop entirely.
The line "//Break to here" is a comment that marks the next line of logic executed after the BREAK.
Process Table
Entity |
Location |
Operation (min) |
---|---|---|
Claim |
Station1 |
WHILE V1<3 DO BEGIN WAIT 3 min IF V3<=5 THEN BEGIN WAIT 3 min BREAK END WAIT 5 min END //Break to here |
Routing Table
Blk |
Output |
Destination |
Rule |
Move Logic |
---|---|---|---|---|
1 |
EntA |
Station2 |
FIRST 1 |
MOVE FOR 5 |
BREAKBLK.